import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from "@angular/forms";
import {RouterModule, Routes} from "@angular/router";
import {ShareModule} from "../../common/share.module";
import {EssComponent} from "./ess.component";
import {EssService} from "./ess.service";
import {MaterialComponent} from './material/material.component';
import {InventoryComponent} from './inventory/inventory.component';
import { EssListComponent } from './ess-list/ess-list.component';
import { MaterialAddComponent } from './material/material-add/material-add.component';
import { InventoryAddComponent } from './inventory/inventory-add/inventory-add.component';
import { InventoryInComponent } from './inventory/inventory-in/inventory-in.component';
import { InventoryOutComponent } from './inventory/inventory-out/inventory-out.component';
import { StorageLogComponent } from './inventory/storage-log/storage-log.component';
import { OutboundLogComponent } from './inventory/outbound-log/outbound-log.component';

const routerConfig: Routes = [{
  path: '',
  component: EssComponent,
  children: [
    {
      path: 'ess-list',
      component: EssListComponent
    },
    {
      path: 'material',
      component: MaterialComponent
    },
    {
      path: 'material/material-add',
      component: MaterialAddComponent
    },
    {
      path: 'inventory',
      component: InventoryComponent
    },
    {
      path: 'inventory/inventory-add',
      component: InventoryAddComponent
    },
    {
      path: 'inventory/inventory-in',
      component: InventoryInComponent
    },
    {
      path: 'inventory/inventory-out',
      component: InventoryOutComponent
    },
    {
      path: 'inventory/storage-log',
      component: StorageLogComponent
    },
    {
      path: 'inventory/outbound-log',
      component: OutboundLogComponent
    },
  ]
}];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    RouterModule.forChild(routerConfig),
    ShareModule
  ],
  declarations: [
    EssComponent,
    MaterialComponent,
    InventoryComponent,
    EssListComponent,
    MaterialAddComponent,
    InventoryAddComponent,
    InventoryInComponent,
    InventoryOutComponent,
    StorageLogComponent,
    OutboundLogComponent,
  ],
  providers: [EssService]
})
export class EssModule {
}
